package a.f.l;

import a.c.d;
import a.c.e;
import a.c.q;
import a.c.z;
import a.d.w;
import a.f.o;

import java.util.Comparator;

class cb
  implements Comparator
{
  private static final double a = 1.0E-007D;
  o b;
  e c;
  
  public cb(o paramo, e parame)
  {
    this.b = paramo;
    this.c = parame;
  }
  
  public int compare(Object paramObject1, Object paramObject2)
  {
    int i4 = g.Cc;
    int i3 = g.Bc;
    d locald1 = (d)paramObject1;
    d locald2 = (d)paramObject2;
    int m = this.c == locald1.e() ? 1 : 0;
    int n = this.c == locald2.e() ? 1 : 0;
    z localz = this.b.o(locald1);
    int i = localz.size();
    if (i4 == 0) {}
    int i1 = i == 2 ? 1 : 0;
    if (i4 == 0) {}
    int k = m != 0 ? 0 : i - 1;
    w localw1 = (w)localz.a(k);
    if (i4 == 0) {}
    k += (m != 0 ? 1 : -1);
    w localw2 = (w)localz.a(k);
    boolean bool1 = a(localw1, localw2);
    boolean bool2 = false;
    if ((i4 != 0) || (i1 == 0))
    {
      if (i4 == 0) {}
      k += (m != 0 ? 1 : -1);
      localObject = (w)localz.a(k);
      bool2 = a(localw1, localw2, (w)localObject);
    }
    Object localObject = this.b.o(locald2);
    int j = ((z)localObject).size();
    if (i4 == 0) {}
    int i2 = j == 2 ? 1 : 0;
    if (i4 == 0) {}
    k = n != 0 ? 0 : j - 1;
    w localw3 = (w)((z)localObject).a(k);
    if (i4 == 0) {}
    k += (n != 0 ? 1 : -1);
    w localw4 = (w)((z)localObject).a(k);
    boolean bool3 = a(localw3, localw4);
    boolean bool4 = false;
    if (i4 == 0) {
      if (i2 == 0)
      {
        if (i4 == 0) {}
        k += (n != 0 ? 1 : -1);
        w localw5 = (w)((z)localObject).a(k);
        bool4 = a(localw3, localw4, localw5);
      }
    }
    if (i4 == 0) {
      if (i1 != 0)
      {
        if (i4 != 0) {
          break label499;
        }
        if (i2 != 0)
        {
          if (i4 == 0) {
            if (bool1 != bool3) {
              return 0;
            }
          }
          double d3 = bool1 ? localw1.a : localw1.b;
          double d4 = bool3 ? localw3.a : localw3.b;
          if (i4 == 0) {
            if (d3 < d4) {
              return -1;
            }
          }
          if (i4 == 0) {
            if (d3 > d4) {
              return 1;
            }
          }
          return 0;
        }
      }
    }
    label499:
    if (i4 == 0) {
      if (i1 != 0)
      {
        if (i4 == 0) {
          if (!bool4) {
            return -1;
          }
        }
        return 1;
      }
    }
    if (i4 == 0) {
      if (i2 != 0)
      {
        if (i4 == 0) {
          if (!bool2) {
            return 1;
          }
        }
        return -1;
      }
    }
    if (i4 == 0) {
      if (bool2)
      {
        if (i4 != 0) {
          break label569;
        }
        if (!bool4) {
          return -1;
        }
      }
    }
    label569:
    if (((i4 != 0) || (!bool2)) && ((i4 != 0) || (bool4))) {
      return 1;
    }
    double d1 = a(localw2, bool1);
    double d2 = a(localw4, bool3);
    if (i4 == 0) {
      if (bool2)
      {
        if (i4 == 0) {
          if (d1 < d2) {
            return -1;
          }
        }
        if (i4 == 0) {
          if (d1 > d2) {
            return 1;
          }
        }
        return 0;
      }
    }
    if (i4 == 0) {
      if (d2 < d1) {
        return -1;
      }
    }
    if (i4 == 0) {
      if (d2 > d1) {
        return 1;
      }
    }
    if ((i4 != 0) || (q.n)) {
      g.Bc = ++i3;
    }
    if (q.o) {
      g.Cc = ++i4;
    }
    return 0;
  }
  
  private final double a(w paramw, boolean paramBoolean)
  {
    if (paramBoolean) {
      return Math.abs(paramw.b - this.b.n(this.c));
    }
    return Math.abs(paramw.a - this.b.m(this.c));
  }
  
  private final boolean a(w paramw1, w paramw2, w paramw3)
  {
    int i = g.Cc;
    if (i == 0) {
      if (Math.abs(paramw1.a - paramw2.a) < Math.abs(paramw1.b - paramw2.b))
      {
        if (i == 0) {}
        return paramw3.a <= paramw2.a;
      }
    }
    if (i == 0) {}
    return paramw3.b <= paramw2.b;
  }
  
  private final boolean a(w paramw1, w paramw2)
  {
    if (g.Cc == 0) {}
    return Math.abs(paramw1.a - paramw2.a) < Math.abs(paramw1.b - paramw2.b);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.cb

 * JD-Core Version:    0.7.0.1

 */